package concurrent.demo2;

import java.util.concurrent.CountDownLatch;

/**
 * 闭锁示例
 *
 * @Author: zhenzhong.wang@honeywell.com
 * @Date: 2019/4/1/001 下午 8:06
 */
public class Boss implements Runnable {

  private CountDownLatch downLatch;

  public Boss(CountDownLatch downLatch) {
    this.downLatch = downLatch;
  }

  @Override
  public void run() {
    System.out.println("老板正在等所有的工人干完活....");
    try {
      this.downLatch.await();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    System.out.println("工人都干完活了，老板开始检查");
  }
}
